import com.bite.www.TestDemo;

import java.util.Arrays;
import java.util.Date;

import static java.lang.Math.*;

class Student{
//    public private protected 这些叫做：访问修饰限定符（当前修饰的字段或者方法的访问权限的）
//    封装：对外隐藏类内部的实现细节
    //将数据和操作数据的方法有机结合起来，隐藏对象的属性和实现细节，仅对外公开接口来和对象进行交互
    //private 将name封装起来了，此时name只能在Student类中使用，不能在Student类外使用
    public String name;
    private int age;
    private String stuNum;
    public static String classNum;


    public Student(){
        this("hhh",22,"11233");
        System.out.println("构造方法。。。。。");
    }

//    public Student(String name, int age, String stuNum) {
//        this.name = name;
//        this.age = age;
//        this.stuNum = stuNum;
//        System.out.println("调用了带三个参数的构造方法");
//
//    }


    public Student(String name, int age, String stuNum) {
        this.name = name;
        this.age = age;
        this.stuNum = stuNum;

    }

    //    public Student(String name,int age,String stuNum){
//        this.name=name;
//        this.age=age;
//        this.stuNum=stuNum;
//        System.out.println("调用了带三个参数的构造方法");
//    }
    public void eat(){
        System.out.println(this.name+"吃饭");
    }

    public void doClass(){
        func1();
        System.out.println(this.name+"上课");
    }

    private void func1(){
        System.out.println("内部方法，封装方法");
    }


//    public void setStu(String name,int age,String stuNum){
//        this.name=name;
//        this.age=age;
//        this.stuNum=stuNum;
//    }
//    public String getName(){
//        return this.name;
//    }
//    public int getAge(){
//        return this.age;
//    }
//    public String getStuNum(){
//        return this.stuNum;
//    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public void show(){
        System.out.println(this.name + " "+ this.age + " "+ this.stuNum + " "+classNum);
    }
}

public class test {

    public static void main(String[] args) {
        Student student11=new Student();
        student11.setName("Zhansgan");
        System.out.println(student11.getName());
        student11.classNum="1班";
        System.out.println(student11.classNum);
//        System.out.println(student11.name);
    }

    public static void main8(String[] args) {
        Student stu2=new Student("张三",116,"111111");
//        stu2.classNum="1班";
        Student.classNum="1班";
        stu2.show();

        Student stu3=new Student("李四",16,"111111");
        stu3.show();
//        stu3.classNum="1班";
        Student stu4=new Student("王五",136,"111111");
//        stu4.classNum="1班";
        stu4.show();
    }

    public static void main7(String[] args) {
        TestDemo testdemo1=new TestDemo();
        testdemo1.test();
        System.out.println(testdemo1.a);
    }

    public static void main6(String[] args) {
        double x=30;
        double y=40;
        double result1=Math.sqrt(Math.pow(x,2)+Math.pow(y,2));
        double result2=sqrt(pow(x,2)+pow(y,2));
        System.out.println(result1);
        System.out.println(result2);
    }

    public static void main5(String[] args) {
        int[] arr={1,2,3,4,4};
        System.out.println(Arrays.toString(arr));
        Date date=new Date();
        java.sql.Date date2=new java.sql.Date(10);
    }


    public static void main4(String[] args) {
        //对封装的成员成员变量初始化和访问
        Student stu1=new Student();
        stu1.setName("张三");
        stu1.setAge(16);
        stu1.setStuNum("111111");
        System.out.println(stu1.getName());
        System.out.println(stu1.getAge());
        System.out.println(stu1.getStuNum());


    }

//    public static void main3(String[] args) {
//        Student stu1=new Student();
//        Student stu2=new Student("张三",116,"111111");
//        System.out.println(stu1.name);
//        System.out.println(stu1.age);
//        System.out.println(stu1.stuNum);
//        System.out.println(stu2.name);
//        System.out.println(stu2.age);
//        System.out.println(stu2.stuNum);
//    }
//
//    public static void main2(String[] args) {
//
//        Student stu1=new Student();
//        stu1.name="张三";
//        stu1.age=16;
//        stu1.stuNum="1234556";
//        stu1.eat();
//        stu1.doClass();
//        System.out.println(stu1.name);
//        System.out.println(stu1.age);
//        System.out.println(stu1.stuNum);
//
//        System.out.println("====================");
//        Student stu2=new Student();
//        stu2.name="lisi";
//        stu2.age=30;
//        stu2.stuNum="1111111";
//        stu2.eat();;
//        stu2.doClass();
//        System.out.println(stu2.name);
//        System.out.println(stu2.age);
//        System.out.println(stu2.stuNum);
//
//    }

    public static void main1(String[] args) {
        System.out.println("hello world");
    }
}
